const Service = require('egg').Service;
class baseService extends Service {
    async getUrl(){
        const { serverUrl } = this.app.config;
        return {
            
        }
    }
    async getService(url,sendData) {
        const { serverUrl } = this.config;
        try{
            const set = {
                data:sendData,
                dataType: 'json',
            };
            const data = await this.ctx.curl(serverUrl+url,set);
            if(data.status!==200){
                this.ctx.render('page/other//404.html');
                return;
            }
            if (data.data.code!==200){
                this.ctx.render('page/other//404.html');
                return;
            }
            return data.data.data;
        }catch (err){
            this.logger.error(err);
            throw new Error(err);
        }
    }
}

module.exports = baseService;
